#ifndef _INCLUDE_OPENNL_S_NETWORK_ADDRESS_
#define _INCLUDE_OPENNL_S_NETWORK_ADDRESS_

/*!
    Copright: Kai "DrHalan" Mast - www.freakybytes.org

    This file is part of OpenNetwork. See OpenNetwork.h for license information.
*/


#include "types.h"

#include <string>

namespace onet
{

    struct SNetworkAddress
    {
        SNetworkAddress(std::string ip_ = "", u16 portNumber_ = 0, bool IPv6_ = false) : ip(ip_), portNumber(portNumber_), IPv6(IPv6_)
        {
        }

        //! The śtring holding the id 4 or 16 chars
        std::string ip;

        //! The portNumber
        u16 portNumber;

        //! Determines wheter the address is IPv6 or not
        bool IPv6;

        bool equals(const SNetworkAddress& other) const
        {
            if (other.portNumber != portNumber)
                return false;

            if (other.IPv6 != IPv6)
                return false;

            if (other.ip != ip)
                return false;

            return true;
        }

        bool operator== (const SNetworkAddress& other) const
        {
            return this->equals(other);
        }
    };

} //!end namespace onet

#endif
